const path = require ('path');

export class  Ini{

    constructor(){}

    static readIni(section, key) {
        let ini = require('node-ini');
        ini.encoding = 'utf-8';
        let config = null;
        if(process.env.NODE_ENV === 'production'){
            config = ini.parseSync(path.dirname(process.execPath) + '/resources/data/config.ini');
        }else {
            config = ini.parseSync('./data/config_test.ini');
        }
        if(config[section]){
            return config[section][key] ? config[section][key] : '';
        }else {
            return '';
        }
    }
}
